package exercise;

import equation.Equation;

public class ExerciseIterator implements Iterator {

    private final Exercise exercise;
    private Integer index;

    public ExerciseIterator(Exercise exercise) {
        this.index = 0;
        this.exercise = exercise;
    }

    @Override
    public boolean existNext() {
        return index < exercise.getData().size();
    }

    @Override
    public Object next() {
        Equation equation = exercise.getData().get(index);
        this.index++;
        return equation;
    }
}
